package titleToNumber;

public class Solution {
    public int titleToNumber(String columnTitle) {
        int res=0;
        for (int i = columnTitle.length()-1,j=0; i >=0; i--,j++) {
            int value=columnTitle.charAt(i)-'A'+1;
            res+=(value*Math.pow(26,j));
        }
        return res;
    }
}
//ABC
// 3*26^0+B*26^1+1*26^2